package com.xgs.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xgs.common.utils.StringUtils;
import com.xgs.system.domain.BasicVersion;
import com.xgs.system.mapper.BasicVersionMapper;
import com.xgs.system.service.BasicVersionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author JerryLu
 * @date 2024/10/23 11:01
 * @description 收费站信息Service业务层处理
 */
@Service
public class BasicVersionServiceImpl extends ServiceImpl<BasicVersionMapper, BasicVersion> implements BasicVersionService {
    @Override
    public List<BasicVersion> queryList(BasicVersion version) {
        QueryWrapper<BasicVersion> queryWrapper = Wrappers.query();
        if (StringUtils.isNotEmpty(version.getVersion())) {
            queryWrapper.like("version", version.getVersion());
        }
        if (StringUtils.isNotEmpty(version.getDeptId())) {
            queryWrapper.eq("dept_id", version.getDeptId());
        }
        if (version.getState() != null) {
            queryWrapper.eq("state", version.getState());
        }
        queryWrapper.orderByDesc("version");

        return this.list(queryWrapper);
    }
}
